package com.ajie.slimming.ui;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.View.OnClickListener;

import com.ajie.slimming.R;

public class SplashActivity extends Activity
{
    // 延迟秒 
    private static final long SPLASH_DELAY_MILLIS = 2000;
    
    private Handler mHandler;
    
    boolean isTurn = false;
    
    Runnable r = new Runnable()
    {
        @Override
        public void run()
        {
        	if(isTurn){
        	}else {
        		Intent intent = new Intent(SplashActivity.this, MainActivity.class);
        		startActivity(intent);
			}
            finish();
        }
    };
    
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        mHandler = new Handler();
        overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
        findViewById(R.id.content).setOnClickListener(new OnClickListener()
        {
            @Override
            public void onClick(View v)
            {
            	Intent intent = new Intent(SplashActivity.this, MainActivity.class);
                startActivity(intent);
                isTurn = true;
            }
        });
        mHandler.postDelayed(r, SPLASH_DELAY_MILLIS);
    }
}
